Repository navigation
fix(text): compare numbers before float rounding - #238
Merged
helloml0326 merged 1 commit intoNov 15, 2026
Merged
Conversation
Co-authored-by: OpenAI Codex <noreply@openai.com>
helloml0326
approved these changes
Nov 15, 2026
5 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OpenJudge Version
0.2.5, main
03c444567d5bb10429b10f4d2ad9df493b0edcc9.Description
NumberAccuracyGrader().aevaluate(response="9007199254740992", reference_response="9007199254740993")returns 1.0, although the values differ by 1 and the default absolute tolerance is 1e-6. Converting tokens to floats merges the two integers before comparison. Equivalent scientific values outside the float range (1e400and10e399) instead score 0.0 because both overflow to infinity.Compare the original numeric tokens using standard-library Decimal arithmetic. Compute a nonnegative difference rounded upwards with a context that represents the tolerance exactly; this preserves inclusive tolerance boundaries even for differences beyond the default decimal precision, independently of the caller's decimal context. The exponent limits avoid expanding large powers into integers. Keep extraction syntax, ordered pairing, reference-count denominator and existing float-valued metadata unchanged. Preserve the previous NaN/infinite tolerance behavior.
Metadata remains a float representation for compatibility; it can still round or overflow. The score is calculated from the original tokens, as described in the updated documentation. No dependency or public API changes.
Validation:
pytest tests/graders/text/ -q: 146 passed (three first-import jieba warnings).pre-commit run --all-files --verbose: all hooks pass, including configured pytest 1232 passed, 139 skipped, five existing NumPy zero-variance warnings. The configured hook excludes multimodal/generator/data/examples; skipped provider tests were not executed.git diff --checkpasses. No model/provider calls or service substitutes in the reproductions/regressions.Existing #202 fixed notation parsing only. Complete relevant searches, all current open PR file lists, and full file history did not identify this comparison fix or an active claim. AI assistance: OpenAI Codex for investigation, implementation and validation.
Checklist
pre-commit run --all-files.